/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mysweethome.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author BKC
 */
@Entity
@Table(name = "GeneralInfo", catalog = "MySweetHomeDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "GeneralInfo.findAll", query = "SELECT g FROM GeneralInfo g"),
    @NamedQuery(name = "GeneralInfo.findByPropertyInfoID", query = "SELECT g FROM GeneralInfo g WHERE g.propertyInfoID = :propertyInfoID"),
    @NamedQuery(name = "GeneralInfo.findByCity", query = "SELECT g FROM GeneralInfo g WHERE g.city = :city"),
    @NamedQuery(name = "GeneralInfo.findByLocation", query = "SELECT g FROM GeneralInfo g WHERE g.location = :location"),
    @NamedQuery(name = "GeneralInfo.findByAvatar", query = "SELECT g FROM GeneralInfo g WHERE g.avatar = :avatar"),
    @NamedQuery(name = "GeneralInfo.findByWidth", query = "SELECT g FROM GeneralInfo g WHERE g.width = :width"),
    @NamedQuery(name = "GeneralInfo.findByHeight", query = "SELECT g FROM GeneralInfo g WHERE g.height = :height"),
    @NamedQuery(name = "GeneralInfo.findByTitle", query = "SELECT g FROM GeneralInfo g WHERE g.title = :title"),
    @NamedQuery(name = "GeneralInfo.findByLongitude", query = "SELECT g FROM GeneralInfo g WHERE g.longitude = :longitude"),
    @NamedQuery(name = "GeneralInfo.findByLatitude", query = "SELECT g FROM GeneralInfo g WHERE g.latitude = :latitude"),
    @NamedQuery(name = "GeneralInfo.findByIsForRentPG", query = "SELECT g FROM GeneralInfo g WHERE g.isForRentPG = :isForRentPG"),
    @NamedQuery(name = "GeneralInfo.findByIsForRent", query = "SELECT g FROM GeneralInfo g WHERE g.isForRent = :isForRent"),
    @NamedQuery(name = "GeneralInfo.findByIsForSale", query = "SELECT g FROM GeneralInfo g WHERE g.isForSale = :isForSale"),
    @NamedQuery(name = "GeneralInfo.findByIsAvailable", query = "SELECT g FROM GeneralInfo g WHERE g.isAvailable = :isAvailable")})
public class GeneralInfo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PropertyInfoID")
    private Integer propertyInfoID;
    @Basic(optional = false)
    @Column(name = "City")
    private String city;
    @Basic(optional = false)
    @Column(name = "Location")
    private String location;
    @Basic(optional = false)
    @Column(name = "Avatar")
    private String avatar;
    @Basic(optional = false)
    @Column(name = "Width")
    private double width;
    @Basic(optional = false)
    @Column(name = "Height")
    private double height;
    @Basic(optional = false)
    @Column(name = "Title")
    private String title;
    @Column(name = "Longitude")
    private Double longitude;
    @Column(name = "Latitude")
    private Double latitude;
    @Basic(optional = false)
    @Column(name = "IsForRentPG")
    private boolean isForRentPG;
    @Basic(optional = false)
    @Column(name = "IsForRent")
    private boolean isForRent;
    @Basic(optional = false)
    @Column(name = "IsForSale")
    private boolean isForSale;
    @Basic(optional = false)
    @Column(name = "IsAvailable")
    private boolean isAvailable;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "generalInfo")
    private DetailPropertyInfo detailPropertyInfo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "generalInfo")
    private List<Follow> followList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "generalInfo")
    private DetailContact detailContact;
    @JoinColumn(name = "PropertyTypeID", referencedColumnName = "TypeID")
    @ManyToOne(optional = false)
    private PropertyType propertyType;
    @JoinColumn(name = "CustomerID", referencedColumnName = "CustomerID")
    @ManyToOne(optional = false)
    private Customer customer;

    public GeneralInfo() {
    }

    public GeneralInfo(Integer propertyInfoID) {
        this.propertyInfoID = propertyInfoID;
    }

    public GeneralInfo(Integer propertyInfoID, String city, String location, String avatar, double width, double height, String title, boolean isForRentPG, boolean isForRent, boolean isForSale, boolean isAvailable) {
        this.propertyInfoID = propertyInfoID;
        this.city = city;
        this.location = location;
        this.avatar = avatar;
        this.width = width;
        this.height = height;
        this.title = title;
        this.isForRentPG = isForRentPG;
        this.isForRent = isForRent;
        this.isForSale = isForSale;
        this.isAvailable = isAvailable;
    }

    public Integer getPropertyInfoID() {
        return propertyInfoID;
    }

    public void setPropertyInfoID(Integer propertyInfoID) {
        this.propertyInfoID = propertyInfoID;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public boolean getIsForRentPG() {
        return isForRentPG;
    }

    public void setIsForRentPG(boolean isForRentPG) {
        this.isForRentPG = isForRentPG;
    }

    public boolean getIsForRent() {
        return isForRent;
    }

    public void setIsForRent(boolean isForRent) {
        this.isForRent = isForRent;
    }

    public boolean getIsForSale() {
        return isForSale;
    }

    public void setIsForSale(boolean isForSale) {
        this.isForSale = isForSale;
    }

    public boolean getIsAvailable() {
        return isAvailable;
    }

    public void setIsAvailable(boolean isAvailable) {
        this.isAvailable = isAvailable;
    }

    public DetailPropertyInfo getDetailPropertyInfo() {
        return detailPropertyInfo;
    }

    public void setDetailPropertyInfo(DetailPropertyInfo detailPropertyInfo) {
        this.detailPropertyInfo = detailPropertyInfo;
    }

    public List<Follow> getFollowList() {
        return followList;
    }

    public void setFollowList(List<Follow> followList) {
        this.followList = followList;
    }

    public DetailContact getDetailContact() {
        return detailContact;
    }

    public void setDetailContact(DetailContact detailContact) {
        this.detailContact = detailContact;
    }

    public PropertyType getPropertyType() {
        return propertyType;
    }

    public void setPropertyType(PropertyType propertyType) {
        this.propertyType = propertyType;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (propertyInfoID != null ? propertyInfoID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GeneralInfo)) {
            return false;
        }
        GeneralInfo other = (GeneralInfo) object;
        if ((this.propertyInfoID == null && other.propertyInfoID != null) || (this.propertyInfoID != null && !this.propertyInfoID.equals(other.propertyInfoID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mysweethome.entities.GeneralInfo[propertyInfoID=" + propertyInfoID + "]";
    }

}
